package com.dingtalk.dingbotmgr.model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 * Created by wyx on 2017/2/27.
 */
@Entity
public class Project {

    private Integer id;

    private String name;

    private Date startDate;

    private Company shejiCompany;

    private Company shigongCompany;

    private Company jianliCompany;

    private Company shenjiCompany;

    private Company zhaobiaoCompany;

    private Integer attachmentCount;

    private Double fund;

    private List<PaymentCategory> paymentCategoryList;

    private List<Attachment> attachmentList;

    @Id
    @GeneratedValue
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "sheji_company_id")
    public Company getShejiCompany() {
        return shejiCompany;
    }

    public void setShejiCompany(Company shejiCompany) {
        this.shejiCompany = shejiCompany;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "shigong_company_id")
    public Company getShigongCompany() {
        return shigongCompany;
    }

    public void setShigongCompany(Company shigongCompany) {
        this.shigongCompany = shigongCompany;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "jianli_company_id")
    public Company getJianliCompany() {
        return jianliCompany;
    }

    public void setJianliCompany(Company jianliCompany) {
        this.jianliCompany = jianliCompany;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "shenji_company_id")
    public Company getShenjiCompany() {
        return shenjiCompany;
    }

    public void setShenjiCompany(Company shenjiCompany) {
        this.shenjiCompany = shenjiCompany;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "zhaobiao_company_id")
    public Company getZhaobiaoCompany() {
        return zhaobiaoCompany;
    }

    public void setZhaobiaoCompany(Company zhaobiaoCompany) {
        this.zhaobiaoCompany = zhaobiaoCompany;
    }

    public Integer getAttachmentCount() {
        return attachmentCount;
    }

    public void setAttachmentCount(Integer attachmentCount) {
        this.attachmentCount = attachmentCount;
    }

    public Double getFund() {
        return fund;
    }

    public void setFund(Double fund) {
        this.fund = fund;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project", cascade = {CascadeType.ALL, CascadeType.REMOVE})
    public List<PaymentCategory> getPaymentCategoryList() {
        return paymentCategoryList;
    }

    public void setPaymentCategoryList(List<PaymentCategory> paymentCategoryList) {
        this.paymentCategoryList = paymentCategoryList;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project", cascade = {CascadeType.ALL, CascadeType.REMOVE})
    public List<Attachment> getAttachmentList() {
        return attachmentList;
    }

    public void setAttachmentList(List<Attachment> attachmentList) {
        this.attachmentList = attachmentList;
    }
}
